package com.stockz.indicator.vsa.pattern;

import java.util.List;

import org.springframework.stereotype.Component;

import com.stockz.core.model.Bar;
import com.stockz.indicator.vsa.VsaBar;
import com.stockz.indicator.vsa.property.Close;
import com.stockz.indicator.vsa.property.Region;
import com.stockz.indicator.vsa.property.Spread;
import com.stockz.indicator.vsa.property.Type;
import com.stockz.indicator.vsa.property.Volume;

@Component
public class NoDemand extends VsaPattern {

	public NoDemand() {
		super("ND", "No Demand", VsaPatternType.Bearish);
	}

	@Override
	public void analyze(List<Bar> barList,List<VsaBar> vsaBarList, int index) {
		VsaBar vsaBar = vsaBarList.get(index);
		if(!Region.OverSold.equals(vsaBar.getRegion())
				&& (Spread.Narrow.equals(vsaBar.getSpread())  || Spread.UltraNarrow.equals(vsaBar.getSpread()) )
				&& Type.Up.equals(vsaBar.getType())
				&& Type.Down.equals(vsaBar.getNextType())
				&& Close.High.equals(vsaBar.getClose())
				&& Volume.Low.equals(vsaBar.getVolume())
				/*&& AverageTradeSize.Low.equals(vsaBar.getAverageTradeSize())*/){
			vsaBar.getVsaPatternList().add(this);
		}
	}

}
